<template>
    <div class="permission-toolbar flex items-center justify-between mb-6">
        <div class="permission-toolbar__left gap-3 flex">
            <a-button type="primary" @click="handleAdd">
                <template #icon>
                    <PlusOutlined />
                </template>
                新增
            </a-button>
            <a-button @click="handleIsSpread">
                <template #icon>
                    <SwapOutlined />
                </template>

                展开/折叠
            </a-button>
        </div>

        <div class="permission-toolbar__right">
            <a-button @click="handleRefresh" :loading="loading">
                <template #icon>
                    <ReloadOutlined />
                </template>
                刷新
            </a-button>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { ReloadOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons-vue'

interface Props {
    loading: boolean
}

interface Emits {
    (e: 'refresh'): void
    (e: 'add'): void
    (e: 'isSpread'): void
}

defineProps<Props>()
const emit = defineEmits<Emits>()
// 处理刷新
const handleRefresh = () => {
    emit('refresh')
}

// 处理新增
const handleAdd = () => {
    emit('add')
}
const handleIsSpread = () => {
    emit('isSpread')
}
</script>

<style lang="scss" scoped></style>
